﻿@model IList<AntJob.Data.Entity.AppOnline>
@using NewLife;
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@{
    var fact = ViewBag.Factory as IEntityFactory;
    var page = ViewBag.Page as Pager;
    var fields = ViewBag.Fields as IList<FieldItem>;
    var set = ViewBag.PageSetting as PageSetting;
    //var provider = ManageProvider.Provider;
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <thead>
        <tr>
            @if (set.EnableSelect)
            {
                <th class="text-center" style="width:10px;"><input type="checkbox" id="chkAll" title="全选" /></th>
            }
            <th class="text-center hidden-md hidden-sm hidden-xs"><a href="@Html.Raw(page.GetSortUrl("ID"))">编号</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("AppID"))">应用</a></th>
            <th class="text-center" title="客户端。IP加进程"><a href="@Html.Raw(page.GetSortUrl("Client"))">客户端</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Version"))">版本</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Server"))">服务端</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Tasks"))">任务数</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Total"))">总数</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Success"))">成功</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Error"))">错误</a></th>
            <th class="text-center" title="耗时。总耗时，秒"><a href="@Html.Raw(page.GetSortUrl("Cost"))">耗时</a></th>
            <th class="text-center" title="速度。每秒处理数"><a href="@Html.Raw(page.GetSortUrl("Speed"))">速度</a></th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("CreateTime"))">创建时间</a></th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("UpdateTime"))">更新时间</a></th>
            @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
            {
                <th class="text-center" style="min-width:100px;">操作</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var entity in Model)
        {
            <tr>
                @if (set.EnableSelect)
                {
                    <td class="text-center"><input type="checkbox" name="keys" value="@entity.ID" /></td>
                }
                <td class="text-center hidden-md hidden-sm hidden-xs">@entity.ID</td>
                <td><a href="App?ID=@entity.AppID">@entity.AppName</a></td>
                <td title="@entity.Name">@entity.Client</td>
                <td>@entity.Version</td>
                <td>@entity.Server</td>
                <td class="text-right"><a href="@Url.Action("Index","JobTask",new {appid=entity.AppID,client=entity.Client})">@entity.Tasks.ToString("n0")</a></td>
                <td class="text-right">@entity.Total.ToString("n0")</td>
                <td class="text-right">@entity.Success.ToString("n0")</td>
                <td class="text-right"><a href="@Url.Action("Index","JobError",new {appid=entity.AppID,client=entity.Client})">@entity.Error.ToString("n0")</a></td>
                <td class="text-right">@TimeSpan.FromSeconds(entity.Cost)</td>
                <td class="text-right">@entity.Speed.ToString("n0")</td>
                <td>@entity.CreateTime.ToFullString("")</td>
                <td>@entity.UpdateTime.ToFullString("")</td>
                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td class="text-center">
                        @await Html.PartialAsync("_List_Data_Action", (Object)entity)
                    </td>
                }
            </tr>
        }
    </tbody>
</table>